import openpyxl


class ExcelReader:
    @staticmethod
    def read_excel_all(file_name, sheet_name):
        workbook = openpyxl.load_workbook(file_name)
        sheet = workbook[sheet_name]
        data = [[sheet.cell(row=i, column=j).value for j in range(1, sheet.max_column + 1)] for i in
                range(2, sheet.max_row + 1)]
        return data

    @staticmethod
    def read_excel_part(file_name, sheet_name, min_row, max_row, min_col, max_col):
        workbook = openpyxl.load_workbook(file_name)
        sheet = workbook[sheet_name]
        data = [[sheet.cell(row=i, column=j).value for j in range(min_col, max_col + 1)] for i in
                range(min_row, max_row + 1)]
        return data


# if __name__ == '__main__':
#     data = ExcelReader.read_excel_part('users.xlsx', 'user', 2, 5, 1, 3)
#     print(data)
